package com.baizan.daka.ui.adapter


import android.widget.ImageView
import android.widget.TextView
import com.baizan.daka.mvp.model.bean.TaskInfoBean
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.dianzan.daka.R

class TaskedAdapter : BaseQuickAdapter<TaskInfoBean, BaseViewHolder>(R.layout.item_taskcheck) {


    override fun convert(helper: BaseViewHolder, item: TaskInfoBean) {
        helper.setText(R.id.user_phone_tv, "申请时间：${item?.overdueTime}")
            .setText(R.id.task_msg_tv, "要求：${item?.taskName}")
            .setText(R.id.price_tv, "¥${item.taskPrice}")
            .setText(R.id.task_No_tv, "编号：${item.taskId}")
            .setVisible(R.id.task_status_iv,false)
        var taskLevel = helper.getView<TextView>(R.id.task_level_tv)
        when (item.taskClass) {
            1 ->
                helper.getView<ImageView>(R.id.task_icon_iv).setImageResource(R.mipmap.icon_douyin)
            2 ->
                helper.getView<ImageView>(R.id.task_icon_iv)
                    .setImageResource(R.mipmap.icon_kuanshou)
            0 -> {
                helper.getView<ImageView>(R.id.task_icon_iv)
                    .setImageResource(R.mipmap.icon_pengyouquan)

            }
        }

        when (item.taskLevel) {
            1 -> {
                taskLevel.text = "初级任务"
                taskLevel.setBackgroundResource(R.drawable.shape_tasking_level_1)

            }
            2 -> {
                taskLevel.text = "中级任务"
                taskLevel.setBackgroundResource(R.drawable.shape_tasking_level_2)

            }
            3 -> {
                taskLevel.text = "高级任务"
                taskLevel.setBackgroundResource(R.drawable.shape_tasking_level_3)

            }
            4 -> {
                taskLevel.text = "至尊任务"
                taskLevel.setBackgroundResource(R.drawable.shape_tasking_level_4)

            }

        }
    }


}